# Contributor: Mike Crute <mike@crute.us>
# Contributor: Jake Buchholz Göktürk <tomalok@gmail.com>
# Maintainer: Jake Buchholz Göktürk <tomalok@gmail.com>
pkgname=tiny-cloud
pkgver=2.0.0
pkgrel=0
pkgdesc="Tiny Cloud instance bootstrapper"
url="https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud"
arch="noarch"
license="MIT"
options="!check"  # no tests provided
depends="e2fsprogs-extra partx sfdisk"
source="$url/-/archive/$pkgver/$pkgname-$pkgver.tar.gz"
subpackages="
	$pkgname-network
	$pkgname-openrc
	$pkgname-aws
	$pkgname-azure
	$pkgname-gcp
	$pkgname-oci
"

package() {
	make PREFIX="$pkgdir" core openrc
}

network() {
	pkgdesc="Tiny Cloud - networking module"
	depends="ifupdown-ng iproute2-minimal $pkgname=$pkgver-r$pkgrel"
	cd "$builddir"
	make PREFIX="$subpkgdir" network
}

aws() {
	pkgdesc="Tiny Cloud - Amazon Web Services module"
	depends="nvme-cli $pkgname-network=$pkgver-r$pkgrel"
	provides="tiny-ec2-bootstrap"
	cd "$builddir"
	make PREFIX="$subpkgdir" aws
}

azure() {
	pkgdesc="Tiny Cloud - Azure module"
	depends="$pkgname=$pkgver-r$pkgrel"
	cd "$builddir"
	make PREFIX="$subpkgdir" azure
}

gcp() {
	pkgdesc="Tiny Cloud - Google Cloud Platform module"
	depends="$pkgname=$pkgver-r$pkgrel"
	cd "$builddir"
	make PREFIX="$subpkgdir" gcp
}

oci() {
	pkgdesc="Tiny Cloud - Oracle Cloud Infrastructure module"
	depends="$pkgname=$pkgver-r$pkgrel"
	cd "$builddir"
	make PREFIX="$subpkgdir" oci
}

sha512sums="
d3c1eb1daf1d298f34459ab2b54c1077b3bc037bbe0df3591cade85ba9d351a47f9ce42fabe5480505236731795679a32f0144998de689f35139aa28ac490d48  tiny-cloud-2.0.0.tar.gz
"
